import React, { useState } from 'react'
import { View } from '@tarojs/components'
import { ConfigProvider, Picker, Cell } from '@nutui/nutui-react-taro'
import './index.scss'
function Index() {
  const [visible1, setVisible1] = useState(false)
  const changePicker = (list: any[], option: any, columnIndex: number) => {
    console.log(columnIndex, option)
  }
  const listData1 = [
    [
      { value: 1, text: '南京市' },
      { value: 2, text: '无锡市' },
      { value: 3, text: '海北藏族自治区' },
      { value: 4, text: '北京市' },
      { value: 5, text: '连云港市' },
      { value: 8, text: '大庆市' },
      { value: 9, text: '绥化市' },
      { value: 10, text: '潍坊市' },
      { value: 12, text: '乌鲁木齐市' },
    ],
  ]
  return (
    <ConfigProvider>
      <View className='nutui-react-demo'>
        <View>
          <Cell
            title="请选择城市"
            onClick={() => setVisible1(!visible1)}
          />
          <Picker
            title="请选择城市"
            visible={visible1}
            options={listData1}
            onClose={() => setVisible1(false)}
            onChange={changePicker}
          />
        </View>
      </View>
    </ConfigProvider>
  )
}

export default Index
